import pandas as pd




coachs = {
    '1': {
        'id': 1,
        'name': 'Gemini(郭家毅)',
        'pic': '1.png',
        'vote': 0
    },
    '2': {
        'id': 2,
        'name': '久哲(胡庄浩)',
        'pic': '2.png',
        'vote': 0
    },
    '3': {
        'id': 3,
        'name': '安之(黄春)',
        'pic': '3.png',
        'vote': 0
    },
    '4': {
        'id': 4,
        'name': '刘雪祥(刘雪祥)',
        'pic': '4.png',
        'vote': 0
    },
    '5': {
        'id': 5,
        'name': '林(吕成林)',
        'pic': '5.png',
        'vote': 0
    },
    '6': {
        'id': 6,
        'name': '黎洛(马鑫)',
        'pic': '6.png',
        'vote': 0
    },
    '7': {
        'id': 7,
        'name': '时皓(时皓)',
        'pic': '7.png',
        'vote': 0
    },
    '8': {
        'id': 8,
        'name': '行天(孙翔)',
        'pic': '8.png',
        'vote': 0
    },
    '9': {
        'id': 9,
        'name': '爱思(唐田)',
        'pic': '9.png',
        'vote': 0
    },
    '10': {
        'id': 10,
        'name': '点点(吴亮)',
        'pic': '10.png',
        'vote': 0
    },
    '11': {
        'id': 11,
        'name': '花楼(杨鹏)',
        'pic': '11.png',
        'vote': 0
    },
    '12': {
        'id': 12,
        'name': 'Kear(张凯)',
        'pic': '12.png',
        'vote': 0
    },
    '13': {
        'id': 13,
        'name': '张角(周宇)',
        'pic': '13.png',
        'vote': 0
    }
}

# coachs = {
#     '1': {
#         'id': 1,
#         'name': 'Gemini(郭家毅)',
#         'pic': '1.png',
#         'vote': 
#          }
#          }

# print(type(coachs))

def cto_pd(): 
    copy_coachs = coachs.copy()
    # print(type(copy_coachs))
    index =[]
    id =[]
    name =[]
    pic =[]
    vote =[]
    
    for i in copy_coachs:
        # 创建各关键字列表
        for j in copy_coachs[i]:   
            x= copy_coachs[i][j]       
            b= eval(j)
            b = b.append(x)
    # print(index,"\n",id,"\n", name,"\n", pic,"\n", vote)


    # 创建二维数组
    
    matrix = {
            "id":id,         
            "name":name,
            "pic":pic,           
            "vote":vote
            }
    df = pd.DataFrame(matrix)
    return df
 
a= cto_pd()

print(a)
a.to_excel('./data/教练清单.xlsx', sheet_name="coachs", index=True)